From 98089778df1c9a5cdef349feaab573fc3ca7d1f6 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 13 Aug 2017 09:03:40 -0400 Subject: [PATCH] Add names to more sources This makes debugging mainloop-related issues more pleasant. --- gdk/x11/gdkdnd-x11.c | 8 +++++--- gtk/gtkentrycompletion.c | 1 + gtk/gtkgesturelongpress.c | 6 ++---- gtk/gtkgesturemultipress.c | 8 ++++---- gtk/gtkscrolledwindow.c | 7 ++++++- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index bd3040b1d7..6841d0ad83 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -2620,6 +2620,7 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context, cairo_surface_t *win_surface; cairo_surface_t *surface; cairo_t *cr; + guint id; if (success) { @@ -2652,9 +2653,10 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context, anim->frame_clock = gdk_window_get_frame_clock (x11_context->drag_window); anim->start_time = gdk_frame_clock_get_frame_time (anim->frame_clock); - gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT, 17, - gdk_drag_anim_timeout, anim, - (GDestroyNotify) gdk_drag_anim_destroy); + id = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT, 17, + gdk_drag_anim_timeout, anim, + (GDestroyNotify) gdk_drag_anim_destroy); + g_source_set_name_by_id (id, "[gtk+] gdk_drag_anim_timeout"); } static gboolean diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c index 6b45e67790..b18616b162 100644 --- a/gtk/gtkentrycompletion.c +++ b/gtk/gtkentrycompletion.c @@ -2603,6 +2603,7 @@ completion_insert_text_callback (GtkEntry *entry, g_cclosure_new_object (G_CALLBACK (check_completion_callback), G_OBJECT (completion))); g_source_attach (completion->priv->check_completion_idle, NULL); + g_source_set_name (completion->priv->check_completion_idle, "[gtk+] check_completion_callback"); } } diff --git a/gtk/gtkgesturelongpress.c b/gtk/gtkgesturelongpress.c index 8cbcce76e7..de4ff7994f 100644 --- a/gtk/gtkgesturelongpress.c +++ b/gtk/gtkgesturelongpress.c @@ -137,10 +137,8 @@ gtk_gesture_long_press_begin (GtkGesture *gesture, gtk_gesture_get_point (gesture, sequence, &priv->initial_x, &priv->initial_y); - priv->timeout_id = - gdk_threads_add_timeout (delay, - _gtk_gesture_long_press_timeout, - gesture); + priv->timeout_id = gdk_threads_add_timeout (delay, _gtk_gesture_long_press_timeout, gesture); + g_source_set_name_by_id (priv->timeout_id, "[gtk+] _gtk_gesture_long_press_timeout"); } static void diff --git a/gtk/gtkgesturemultipress.c b/gtk/gtkgesturemultipress.c index c61273569a..e0816cf808 100644 --- a/gtk/gtkgesturemultipress.c +++ b/gtk/gtkgesturemultipress.c @@ -150,10 +150,10 @@ _gtk_gesture_multi_press_update_timeout (GtkGestureMultiPress *gesture) settings = gtk_widget_get_settings (widget); g_object_get (settings, "gtk-double-click-time", &double_click_time, NULL); - priv->double_click_timeout_id = - gdk_threads_add_timeout (double_click_time, - _double_click_timeout_cb, - gesture); + priv->double_click_timeout_id = gdk_threads_add_timeout (double_click_time, + _double_click_timeout_cb, + gesture); + g_source_set_name_by_id (priv->double_click_timeout_id, "[gtk+] _double_click_timeout_cb"); } static gboolean diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 5310eace71..f791303e7c 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -1148,7 +1148,10 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw, if (on_scrollbar) indicator_set_over (indicator, TRUE); else if (indicator_close && !on_other_scrollbar) - indicator->over_timeout_id = gdk_threads_add_timeout (30, enable_over_timeout_cb, indicator); + { + indicator->over_timeout_id = gdk_threads_add_timeout (30, enable_over_timeout_cb, indicator); + g_source_set_name_by_id (indicator->over_timeout_id, "[gtk+] enable_over_timeout_cb"); + } else indicator_set_over (indicator, FALSE); @@ -3759,7 +3762,9 @@ indicator_set_fade (Indicator *indicator, if (visible) { +if (indicator->conceil_timer != 0) g_print ("leaking conceil_timer!\n"); indicator->conceil_timer = g_timeout_add (INDICATOR_FADE_OUT_TIME, maybe_hide_indicator, indicator); + g_source_set_name_by_id (indicator->conceil_timer, "[gtk+] maybe_hide_indicator"); } if (!visible && gtk_widget_get_mapped (indicator->scrollbar) && indicator->conceil_timer != 0) -- 2.30.2